package com.railway.util;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**用于响应传出json
 * @author 33676
 *
 */
public class JSONUtil {
	
	public static void responJSOn(HttpServletResponse resp,Object o) throws JsonProcessingException, IOException {
		ObjectMapper om = new ObjectMapper();
		resp.setCharacterEncoding("UTF-8");
		resp.setContentType("application/json,charset=utf-8");
		resp.getWriter().print(om.writeValueAsString(o));
	}
}
